<?php
error_reporting(0);
$isadmin=1;
include '../../comm/config.php';
include '../check.php';
include('../../comm/class_db.php');
$link = mysql_connect($dbserver, $dbuser, $dbpass);
mysql_query("set names utf8");	
mysql_select_db($dbname);

function check_addslashes($content){
	if(get_magic_quotes_gpc()==0){
	    $content = addslashes($content);
	}
	return $content;
}

$_POST ['content']=check_addslashes($_POST ['content']);

$id=$_POST['id'];
$lm=$_POST['lm'];
$catid=$_POST['cat'];
$merchant=$_POST['merchant'];
$logo=$_POST['picname'];
$url=$_POST['url'];
$hdfk=$_POST['hdfk'];
$zgfp=$_POST['zgfp'];
$yfzc=$_POST['yfzc'];
$js=$_POST['content'];
$fan=$_POST['fan'];
$name=$_POST['name'];
$des=$_POST['des'];
$yilink=$_POST['yilink'];
$chalink=$_POST['chalink'];
$sort=$_POST['sort']?$_POST['sort']:255;

if($id=='')
{
	$filed_arr=array('name'=>$name,'merchant'=>$merchant,'url'=>$url,'logo'=>$logo,'catid'=>$catid,'fan'=>$fan,'hdfk'=>$hdfk,'zgfp'=>$zgfp,'yfzc'=>$yfzc,'des'=>$des,'js'=>$js,'sort'=>$sort,'yilink'=>$yilink,'lm'=>$lm,'time'=>date('Y-m-d H:i:s'));
    sql_insert_one("mall",$filed_arr);
}
else
{
	$filed_arr=array('name'=>$name,'merchant'=>$merchant,'url'=>$url,'logo'=>$logo,'catid'=>$catid,'fan'=>$fan,'hdfk'=>$hdfk,'zgfp'=>$zgfp,'yfzc'=>$yfzc,'des'=>$des,'js'=>$js,'sort'=>$sort,'yilink'=>$yilink,'lm'=>$lm);
    sql_update("mall",$filed_arr,"id",$id);
}

mysql_close($link);
?>
<script>
alert('保存成功！');
history.go(-1);
</script>